
package net.qiqbframework.commandhandling;

import java.util.function.Supplier;

public interface ApplyMore {

    ApplyMore andThenApply(Supplier<?> payloadOrMessageSupplier);


    default ApplyMore andThenApplyIf(Supplier<Boolean> condition, Supplier<?> payloadOrMessageSupplier) {
        if (condition.get()) {
            return andThenApply(payloadOrMessageSupplier);
        } else {
            return this;
        }
    }

    ApplyMore andThen(Runnable runnable);


    default ApplyMore andThenIf(Supplier<Boolean> condition, Runnable runnable) {
        if (condition.get()) {
            return andThen(runnable);
        } else {
            return this;
        }
    }
}
